package com.numberone.system.service.impl;

import com.numberone.common.support.Convert;
import com.numberone.system.domain.GoodsImg;
import com.numberone.system.mapper.GoodsImgMapper;
import com.numberone.system.mapper.GoodsMapper;
import com.numberone.system.service.IGoodsImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品图片 服务层实现
 * 
 * @author numberone
 * @date 2020-09-28
 */
@Service
public class GoodsImgServiceImpl implements IGoodsImgService
{
	@Autowired
	private GoodsImgMapper goodsImgMapper;
	@Autowired
	private GoodsMapper goodsMapper;

	/**
     * 查询商品图片信息
     * 
     * @param id 商品图片ID
     * @return 商品图片信息
     */
    @Override
	public GoodsImg selectGoodsImgById(Long id)
	{
	    return goodsImgMapper.selectGoodsImgById(id);
	}
	
	/**
     * 查询商品图片列表
     * 
     * @param goodsImg 商品图片信息
     * @return 商品图片集合
     */
	@Override
	public List<GoodsImg> selectGoodsImgList(GoodsImg goodsImg)
	{
	    return goodsImgMapper.selectGoodsImgList(goodsImg);
	}
	
    /**
     * 新增商品图片
     * 
     * @param goodsImg 商品图片信息
     * @return 结果
     */
	@Override
	public int insertGoodsImg(GoodsImg goodsImg)
	{
	    return goodsImgMapper.insertGoodsImg(goodsImg);
	}
	
	/**
     * 修改商品图片
     * 
     * @param goodsImg 商品图片信息
     * @return 结果
     */
	@Override
	public int updateGoodsImg(GoodsImg goodsImg)
	{
	    return goodsImgMapper.updateGoodsImg(goodsImg);
	}

	/**
     * 删除商品图片对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteGoodsImgByIds(String ids)
	{
		return goodsImgMapper.deleteGoodsImgByIds(Convert.toStrArray(ids));
	}

	/**
	 * 根据商品查询商品图片
	 * @param goodsId
	 * @return
	 */
	@Override
	public List<GoodsImg> selectGoodsImgByGoodsId(Long goodsId)
	{
		List<GoodsImg> goodsImgs = goodsImgMapper.selectGoodsImgByGoodsId(goodsId);
		return goodsImgs;
	}

}
